package com.massyframework.beanskin.runtime.modular.fragment;

import java.util.List;
import java.util.Set;
import java.util.function.Consumer;

import com.massyframework.beanskin.ModuleIdentifier;
import com.massyframework.beanskin.ModuleRepository;
import com.massyframework.beanskin.RequireLibraryDescriptor;
import com.massyframework.beanskin.fragment.Fragment;
import com.massyframework.beanskin.fragment.FragmentBuilder;
import com.massyframework.beanskin.runtime.modular.InitParamsBuilder;
import com.massyframework.beanskin.service.ServiceRepositoryFactory;
import com.massyframework.beanskin.util.classloading.ModuleClassLoader;

/**
 * 片段构建器
 * @author huangkh
 *
 */
public class DefaultFragmentBuilder extends InitParamsBuilder 
	implements FragmentBuilder{
	
	public DefaultFragmentBuilder() {
		
	}
	
	/**
	 * 使用{@code id}创建新实例
	 * @param id {@link Integer}
	 */
	public DefaultFragmentBuilder(Integer id) {
		super(id);
	}

	@Override
	public DefaultFragmentBuilder setParameter(String name, String value) {
		super.setParameter(name, value);
		return this;
	}


	@Override
	public DefaultFragmentBuilder setParameter(String name, String value, Consumer<Boolean> action) {
		super.setParameter(name, value, action);
		return this;
	}



	@Override
	public DefaultFragmentBuilder identifier(ModuleIdentifier value) {
		super.identifier(value);
		return this;
	}



	@Override
	public DefaultFragmentBuilder name(String value) {
		super.name(value);
		return this;
	}

	@Override
	public DefaultFragmentBuilder description(String value) {
		super.description(value);
		return this;
	}

	@Override
	public DefaultFragmentBuilder addRequireLibrary(RequireLibraryDescriptor value) {
		super.addRequireLibrary(value);
		return this;
	}

	@Override
	public DefaultFragmentBuilder addTags(Set<String> value) {
		super.addTags(value);
		return this;
	}

	@Override
	public DefaultFragmentBuilder moduleRepository(ModuleRepository value) {
		super.moduleRepository(value);
		return this;
	}

	@Override
	public DefaultFragmentBuilder decryption(String publicKey, String x509Name, String x509Encrypted,
			List<String> classNames, List<String> scriptFileNames) {
		super.decryption(publicKey, x509Name, x509Encrypted, classNames, scriptFileNames);
		return this;
	}

	@Override
	public DefaultFragmentBuilder developer(String shortName, String name, String homePage) {
		super.developer(shortName, name, homePage);
		return this;
	}

	@Override
	public DefaultFragmentBuilder classLoader(ModuleClassLoader value) {
		super.classLoader(value);
		return this;
	}

	@Override
	public DefaultFragmentBuilder serviceRepositoryFactory(ServiceRepositoryFactory value) {
		super.serviceRepositoryFactory(value);
		return this;
	}

	
	@Override
	public Fragment build() {
		return new DefaultFragment(this);
	}

}
